<!-- 在供给方组件内 -->
<script setup>
import { provide, ref } from 'vue'
import InjectChild from './InjectChild.vue'

const location = ref('North Pole')

function updateLocation() {
  location.value = 'South Pole'
}

provide('location', {
  location,
  updateLocation
})
</script>
<template>
  <div>
    {{ location }}

    <inject-child></inject-child>
  </div>
</template>